import request from '@/utils/request'
import { parseStrEmpty } from "@/utils/wb";

// 查询题库列表
export function listQuestion(data) {
  return request({
    url: '/question/list',
    method: 'post',
    data
  })
}

// 查询题库详细
export function getQuestion(id) {
  return request({
    url: '/question/' + parseStrEmpty(id),
    method: 'get'
  })
}

// 新增题库
export function addQuestion(data) {
  return request({
    url: '/question/add',
    method: 'post',
    data
  })
}

// 修改题库
export function updateQuestion(data) {
  return request({
    url: '/question/update',
    method: 'post',
    data
  })
}

// 删除题库（支持批量）
export function delQuestion(idOrIds) {
  const ids = Array.isArray(idOrIds) ? idOrIds : [idOrIds]
  return request({
    url: '/question/deleteAll',
    method: 'delete',
    data: { ids }
  })
}

